#ifndef FUNCTIONS_H
#define FUNCTIONS_H


/* Type definition for every function from call function */
typedef int FUNC_TYPE;

/*Type definition for pointer to main functions of the commands*/
typedef FUNC_TYPE (*API_TYPE)(int num_tokens, char* tokens[]);

/* null constant if not App routine */
#define API_PTR (API_TYPE)0

/*Type definition for main functions of the commands*/
typedef struct{
    /* the command name */
    char  CommandName[30]; //

    /* the main function */
    API_TYPE  FunctionName;

} GENERAL_COMMAND_LIST;

struct node {
	char envar[128];
	char value[128];
	struct node* next;
};

typedef struct  {

    int in,out ;
    char *outfile;
	char *infile;
    unsigned int f_rdirect   :2 ; // flags will determine if a  requested  cmd or possible combination , can be  precessed
    unsigned int f_bkg       :1 ;
    unsigned int f_pipe      :3 ;
    unsigned int f_support   :1 ;

}redirection ;


struct node* enVarList;
//extern getpipes(int num_tokens, char* tokens[]);
extern const GENERAL_COMMAND_LIST mainCommandList[8];
extern int comb_support(redirection x) ;
extern redirection io_redirection(int num_tokens, char* tokens[]);
extern FUNC_TYPE exit_func(int num_tokens, char* tokens[]);
extern FUNC_TYPE pwd_func(int num_tokens, char* tokens[]);
extern FUNC_TYPE clear_func(int num_tokens, char* tokens[]);
extern FUNC_TYPE ls_func(int num_tokens, char* tokens[]);
extern FUNC_TYPE cd_func(int num_tokens, char* tokens[]);
extern FUNC_TYPE setenv_func(int num_tokens, char* tokens[]);
extern FUNC_TYPE unsetenv_func(int num_tokens, char* tokens[]);
extern FUNC_TYPE environ_func(int num_tokens, char* tokens[]);

extern void lsrec( char* tokens[] , int num_tokens  );
extern FUNC_TYPE external_func(int num_tokens, char* tokens[]);
extern FUNC_TYPE pipetrial_func(int num_tokens, char* tokens[]);
extern FUNC_TYPE background_func(int num_tokens, char* tokens[]);

#endif
